/*
 * regs.h
 *
 *  Created on: Sep 28, 2016
 *      Author: duan
 */

#ifndef REGS_H_
#define REGS_H_

#include "xparameters.h"

#define fusion_base     ((unsigned int *) XPAR_FUSION_CTRL_0_S_AXI_RNG00_BASEADDR)
#define RESERVE_START   (XPAR_MCB_DDR3_S0_AXI_BASEADDR + 0x07000000)

#define rSCCB0_CTRCL    (*(volatile unsigned int *)(fusion_base + 0))
#define rSCCB0_READ     (*(volatile unsigned int *)(fusion_base + 1))
#define rCAM0_CTRL      (*(volatile unsigned int *)(fusion_base + 2))
#define rCAM0_BUF0      (*(volatile unsigned int *)(fusion_base + 3))
#define rCAM0_BUF1      (*(volatile unsigned int *)(fusion_base + 4))
#define rCAM0_BUF2      (*(volatile unsigned int *)(fusion_base + 5))
#define rCAM0_PARAM     (*(volatile unsigned int *)(fusion_base + 6))
#define rCAM0_SCALER    (*(volatile unsigned int *)(fusion_base + 7))
#define rCAM0_ERR       (*(volatile unsigned int *)(fusion_base + 8))
#define rCAM0_PWR       (*(volatile unsigned int *)(fusion_base + 9))

#define rSCCB1_CTRCL    (*(volatile unsigned int *)(fusion_base + 10))
#define rSCCB1_READ     (*(volatile unsigned int *)(fusion_base + 11))
#define rCAM1_CTRL      (*(volatile unsigned int *)(fusion_base + 12))
#define rCAM1_BUF0      (*(volatile unsigned int *)(fusion_base + 13))
#define rCAM1_BUF1      (*(volatile unsigned int *)(fusion_base + 14))
#define rCAM1_BUF2      (*(volatile unsigned int *)(fusion_base + 15))
#define rCAM1_PARAM     (*(volatile unsigned int *)(fusion_base + 16))
#define rCAM1_SCALER    (*(volatile unsigned int *)(fusion_base + 17))
#define rCAM1_ERR       (*(volatile unsigned int *)(fusion_base + 18))
#define rCAM1_PWR       (*(volatile unsigned int *)(fusion_base + 19))

#define rMENU_BUF0      (*(volatile unsigned int *)(fusion_base + 20))
#define rMENU_BUF1      (*(volatile unsigned int *)(fusion_base + 21))
#define rMENU_BUF2      (*(volatile unsigned int *)(fusion_base + 22))
#define rVGA_CTRL       (*(volatile unsigned int *)(fusion_base + 23))
#define rVGA_PCNT       (*(volatile unsigned int *)(fusion_base + 24))
#define rMENU_ALPHA     (*(volatile unsigned int *)(fusion_base + 25))
#define rBACKLIGHT      (*(volatile unsigned int *)(fusion_base + 26))

#define rADC_CTRL       (*(volatile unsigned int *)(fusion_base + 36))
#define rADC_READ       (*(volatile unsigned int *)(fusion_base + 37))

#define rGAOYA_TIME     (*(volatile unsigned int *)(fusion_base + 40)) //gaoya_time;
#define rGAOYA_FRORCE   (*(volatile unsigned int *)(fusion_base + 41)) //{24'b0,gaoya_force};
#define rHEAT_CTRL      (*(volatile unsigned int *)(fusion_base + 42)) //{heat_mode,7'b0,heat_speed,heat_time};
#define rBEEP_ON        (*(volatile unsigned int *)(fusion_base + 43)) //beep_cntr[31:24],tone_divider[23:0];
#define rXNS_DELAY      (*(volatile unsigned int *)(fusion_base + 44)) //;
#define rRTC_CTRL       (*(volatile unsigned int *)(fusion_base + 45)) //rtc_ctrl;
#define rRTC_READ       (*(volatile unsigned int *)(fusion_base + 46)) //{16'b0,rtc_data_read};
#define rTIME_LOAD      (*(volatile unsigned int *)(fusion_base + 47)) //{31'b0,load_time};
#define rDATE_REMOTE    (*(volatile unsigned int *)(fusion_base + 48)) //pcf8563_date;
#define rTIME_REMOTE    (*(volatile unsigned int *)(fusion_base + 49)) //pcf8563_time;
#define rDTAE_LOCAL     (*(volatile unsigned int *)(fusion_base + 50)) //local_date;
#define rTIME_LOCAL     (*(volatile unsigned int *)(fusion_base + 51)) //local_time;
#define rPARAM_CTRL     (*(volatile unsigned int *)(fusion_base + 52)) //eeprom_ctrl;
#define rPARAM_READ     (*(volatile unsigned int *)(fusion_base + 53)) //{16'b0,eeprom_data_read};

#define rVIEW_XY        (*(volatile unsigned int *)(fusion_base + 55 ))
#define rKEY_VALUE      (*(volatile unsigned int *)(fusion_base + 60 )) //{20'h0,fusion_keys[11:0]};
#define rFLOW_ERR       (*(volatile unsigned int *)(fusion_base + 61 )) //flow_err;
#define rFUSION_GAOYA   (*(volatile unsigned int *)(fusion_base + 62 )) //{clean,pre,8'b0,splice}
#define rFUSION_TIME    (*(volatile unsigned int *)(fusion_base + 63 )) //{clean,pre,splice[15:0]} in ms

#define rPUSH_CTRL      (*(volatile unsigned int *)(fusion_base + 70 )) //fusion_push_ctrl signal groups: mode for level ,ctrl for posedge
#define rBASE_X         (*(volatile unsigned int *)(fusion_base + 71 )) //{20'b0,fusion_base_x};
#define rTOUCH_STATUS   (*(volatile unsigned int *)(fusion_base + 72 )) //{24'b0,touch_status};
#define rPIX_SENS       (*(volatile unsigned int *)(fusion_base + 73 )) //{16'b0,fusion_edge_sens,fusion_face_sens};
#define rBLACK_PIX      (*(volatile unsigned int *)(fusion_base + 74 )) //{24'b0,fusion_pix_black}; 
 
#define rAUX_CTRL       (*(volatile unsigned int *)(fusion_base + 75 ))
#define rINFO_REQ       (*(volatile unsigned int *)(fusion_base + 76 )) //{cpu_info_ready,30'b0,cpu_info_req}; 
#define rLPUSH_CFG      (*(volatile unsigned int *)(fusion_base + 77 )) //{4'b0,fusion_slow_l_x,4'b0,fusion_fast_l_x}; 
#define rRPUSH_CFG      (*(volatile unsigned int *)(fusion_base + 78 )) //{4'b0,fusion_slow_r_x,4'b0,fusion_fast_r_x}; 
#define rPUSH_STAT      (*(volatile unsigned int *)(fusion_base + 80 )) //fusion_push_state;
#define rFIBER_STATUS   (*(volatile unsigned int *)(fusion_base + 81 )) //fiber_push_status;
#define rIICCFG_STATE   (*(volatile unsigned int *)(fusion_base + 83 )) //iic_cfg_state;

#define rEDGE1_SUM      (*(volatile unsigned int *)(fusion_base + 90 )) //pix0_rang0_edge_accum;
#define rEDGE2_SUM      (*(volatile unsigned int *)(fusion_base + 91 )) //pix0_rang1_edge_accum;
#define rEDGE3_SUM      (*(volatile unsigned int *)(fusion_base + 92 )) //pix0_rang2_edge_accum;
#define rEDGE4_SUM      (*(volatile unsigned int *)(fusion_base + 93 )) //pix0_rang3_edge_accum;
#define rBOLD1_SUM      (*(volatile unsigned int *)(fusion_base + 94 )) //pix0_rang0_core_accum;
#define rBOLD2_SUM      (*(volatile unsigned int *)(fusion_base + 95 )) //pix0_rang1_core_accum;
#define rCORE1_SUM      (*(volatile unsigned int *)(fusion_base + 96 )) //pix0_rang2_core_accum;
#define rCORE2_SUM      (*(volatile unsigned int *)(fusion_base + 97 )) //pix0_rang3_core_accum;
#define rEDGE5_SUM      (*(volatile unsigned int *)(fusion_base + 100)) //pix1_rang0_edge_accum;
#define rEDGE6_SUM      (*(volatile unsigned int *)(fusion_base + 101)) //pix1_rang1_edge_accum;
#define rEDGE7_SUM      (*(volatile unsigned int *)(fusion_base + 102)) //pix1_rang2_edge_accum;
#define rEDGE8_SUM      (*(volatile unsigned int *)(fusion_base + 103)) //pix1_rang3_edge_accum;
#define rBOLD3_SUM      (*(volatile unsigned int *)(fusion_base + 104)) //pix1_rang0_core_accum;
#define rBOLD4_SUM      (*(volatile unsigned int *)(fusion_base + 105)) //pix1_rang1_core_accum;
#define rCORE3_SUM      (*(volatile unsigned int *)(fusion_base + 106)) //pix1_rang2_core_accum;
#define rCORE4_SUM      (*(volatile unsigned int *)(fusion_base + 107)) //pix1_rang3_core_accum;
#define rINFO_READY0    (*(volatile unsigned int *)(fusion_base + 108))
#define rINFO_READY1    (*(volatile unsigned int *)(fusion_base + 109))
#define rPWR_CTRL       (*(volatile unsigned int *)(fusion_base + 110))
#define rENGIN_EDG0     (*(volatile unsigned int *)(fusion_base + 111))
#define rENGIN_EDG1     (*(volatile unsigned int *)(fusion_base + 112))
#define rCALIB_EDG0     (*(volatile unsigned int *)(fusion_base + 113))
#define rCALIB_EDG1     (*(volatile unsigned int *)(fusion_base + 114))
#define rCALIB_BRHT     (*(volatile unsigned int *)(fusion_base + 118))

#define rMOTOR_SPPED    (*(volatile unsigned int *)(fusion_base + 130))
#define rL_MOTOR        (*(volatile unsigned int *)(fusion_base + 131))
#define rR_MOTOR        (*(volatile unsigned int *)(fusion_base + 132))
#define rX_MOTOR        (*(volatile unsigned int *)(fusion_base + 133))
#define rY_MOTOR        (*(volatile unsigned int *)(fusion_base + 134))

#define rCORETEMP       (*(volatile unsigned int *)(fusion_base + 160))
#define rVCCINT         (*(volatile unsigned int *)(fusion_base + 161))
#define rVCCAUX         (*(volatile unsigned int *)(fusion_base + 162))
#define rVPIN           (*(volatile unsigned int *)(fusion_base + 163))
#define rVTMP           (*(volatile unsigned int *)(fusion_base + 164))

#define rMHID0          (*(volatile unsigned int *)(fusion_base + 180))
#define rMHID1          (*(volatile unsigned int *)(fusion_base + 181))

#define rVERSION        (*(volatile unsigned int *)(fusion_base + 200))

/************************** Constant Definitions ****************************/
#define udelay(x)       rXNS_DELAY = x*100; while(rXNS_DELAY > 0)


#endif /* SRC_MACRO_DEF_H_ */
